#pragma once
#include "ExtentEntry.h"
#include "LunTotalStatistics.h"
#include "ExtentStatsAlgo.h"
#include <vector>
#include <map>
#include <iostream>
#include <string>
#include <list>

//Class for sorting the ExtentsStatsAlgo vector - 2 ways of sorting: first is merge sort and the second is percentage sort
class Sorter
{
	vector<ExtentStatsAlgo*> sortedExtents;
	vector<ExtentStatsAlgo*> b;
	vector<ExtentStatsAlgo*>* sorted;
	map<LUNID, LunTotalStatistics*>* luns;
	int sort_type;

	vector<ExtentStatsAlgo*>* percentageSort(vector<ExtentStatsAlgo*>* extents);
	void merge_sort(int low,int high);
	void merge(int low,int mid,int high);
	

public:
	double high1, low1,high2, low2, high3, low3;

	/*Constructor*/
	Sorter(map<LUNID, LunTotalStatistics*>* l, int sortType) { sort_type = sortType; sorted = new vector<ExtentStatsAlgo*>(); luns = l; high1=0; low1=99999999; high2=0; low2=99999999; high3=0; low3=99999999;};
	/*Destructor*/
	virtual ~Sorter(void);

	//Sorting the extentStatsAlgo vector according to the sortType required (1 for percentage sort else merge sort)
	vector<ExtentStatsAlgo*>* sort(vector<ExtentStatsAlgo*>* extents);
	
};

